import config from '@/styles/theme/config.js';
// let CONFIG  = require('@/setting/config.json');
// console.log('CONFIG',CONFIG);
export default {
	state: {
		themeName:uni.getStorageSync('ThemeName') || 'light',//有限从本地读取配置
	},
	getters: {
		theme(state) {
			// 设置导航条
		   uni.setNavigationBarColor(config[state.themeName].navBar);
		    // 设置tabbar
		 //    try{
			// 	uni.setTabBarStyle(config[state.themeName].tabBar); 
			// }catch(e){
				
			// }
			
			return config[state.themeName];
		}
	},
	mutations: {
		setTheme(state, themeName = "light") {
			state.themeName = themeName;
			uni.setStorageSync('ThemeName',state.themeName);//设置后保存本地
		}
	}
}

//Vuex的方式 
    // 设置导航条
    // uni.setNavigationBarColor(this.$store.state.theme.navBar);
    // // 设置tabbar
    // uni.setTabBarStyle(this.$store.state.theme.tabBar); 